package com.wagn.oss.controller;

import com.wagn.oss.service.OssService;
import com.wagn.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/service_oss/oss")
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    //上传头像的api
    @PostMapping("uploadavatar")
    public R uploadAvatar(MultipartFile file){
        String url = ossService.uploadAvatar(file);
        return R.ok().data("url",url);
    }


}
